package com.gzhryc.shared_device.cdb.code.dao.db;

import com.gzhryc.jdbc.annotaion.Column;
import com.gzhryc.jdbc.annotaion.Id;
import com.gzhryc.jdbc.annotaion.Table;
import com.gzhryc.shared_device.cdb.code.dao.enums.PortableBatteryEnum;

import java.io.Serializable;
import java.util.Date;

/**
 * 共享充电宝
 * 
 * @author zhanghao
 * @version 2022-09-04
 */
@Table(name = "dev_portable_battery")
public class PortableBattery implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id(auto = false)
	@Column(name = "device_sn", length = 32, notNull = true, note = "设备序列号")
	protected String deviceSn;

	@Column(name = "cabinet_device_sn", length = 32, note = "充电柜设备序列号")
	protected String cabinetDeviceSn;

	@Column(name = "slot_num", note = "当前卡槽位置")
	protected Integer slotNum;

	@Column(name = "version_number", note = "版本号")
	protected String versionNumber;

	@Column(name = "power", note = "电量")
	protected Double power;

	@Column(name = "current_trade_no", length = 32, note = "当前执行的订单")
	protected String currentTradeNo;

	@Column( notNull = true, defVal = "1", note = "设备状态")
	protected Integer state;

	@Column(name = "last_lease_date", note = "最后租借时间")
	protected Date lastLeaseDate;
	
	@Column(name = "last_heart_date", note = "最后心跳时间")
	protected Date lastHeartDate;
	
	@Column(name = "update_date", note = "修改时间", autoUpdateTime = true)
	protected Date updateDate;

	@Column(name = "create_date")
	protected Date createDate;

	public String getDeviceSn() {
		return deviceSn;
	}

	public void setDeviceSn(String deviceSn) {
		this.deviceSn = deviceSn;
	}

	public String getCabinetDeviceSn() {
		return cabinetDeviceSn;
	}

	public void setCabinetDeviceSn(String cabinetDeviceSn) {
		this.cabinetDeviceSn = cabinetDeviceSn;
	}

	public Integer getSlotNum() {
		return slotNum;
	}

	public void setSlotNum(Integer slotNum) {
		this.slotNum = slotNum;
	}

	public Integer getState() {
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	public String getVersionNumber() {
		return versionNumber;
	}

	public void setVersionNumber(String versionNumber) {
		this.versionNumber = versionNumber;
	}

	public Double getPower() {
		return power;
	}

	public void setPower(Double power) {
		this.power = power;
	}

	public String getCurrentTradeNo() {
		return currentTradeNo;
	}

	public void setCurrentTradeNo(String currentTradeNo) {
		this.currentTradeNo = currentTradeNo;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Date getLastLeaseDate() {
		return lastLeaseDate;
	}

	public void setLastLeaseDate(Date lastLeaseDate) {
		this.lastLeaseDate = lastLeaseDate;
	}

	public Date getLastHeartDate() {
		return lastHeartDate;
	}

	public void setLastHeartDate(Date lastHeartDate) {
		this.lastHeartDate = lastHeartDate;
	}

	public String getStateName() {
		return PortableBatteryEnum.State.note(this.state);
	}

}
